package model;

import java.util.ArrayList;

public class Scoreboard {
        
        private int score = 0;
        
        private ArrayList<Goal> period1;
        private ArrayList<Goal> period2;
        private ArrayList<Goal> period3;
        
        
        public Scoreboard() {
        	period1 = new ArrayList<Goal>();
        	period2 = new ArrayList<Goal>();
        	period3 = new ArrayList<Goal>();
        }
        
        /**
         * 
         * @param num: 1 for 1st period, 2 for 2nd period, 3 for 3rd period
         * @return
         */
        public ArrayList<Goal> getPeriod(int num){
                if (num == 1)
                        return period1;
                else if (num == 2)
                        return period2;
                else if (num == 3)
                        return period3;
                else return null;
        };
        
        public void addGoal(int period, Player scorer, Player assist1, Player assist2){
                
                if (period == 1){
                        period1.add(new Goal(scorer, assist1, assist2));
                        addScore();
                        }
                else if (period == 2){
                        period2.add(new Goal(scorer, assist1, assist2));
                        addScore();
                        }
                else if (period == 3){
                        period3.add(new Goal(scorer, assist1, assist2));
                        addScore();
                        }
        }
        
        public void addScore(){
                score++;
        }
        
        public int getScore(){
                return score;
        }

}